package com.tencent.wxcloudrun.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tencent.wxcloudrun.dao.UserMapper;
import com.tencent.wxcloudrun.model.PayReq;
import com.tencent.wxcloudrun.model.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * ClassName: UserService
 * Package: com.tencent.wxcloudrun.service
 * Description:
 *
 * @Date: 2023/1/23 2:04 PM
 * @Author: wht
 */
@Slf4j
@Service
public class UserService {
    @Autowired
    UserMapper userMapper;


    public void updateOneUserById(User user) {
        userMapper.updateOneUserById(user);
    }

    public PageInfo getUserList(User user) {
        PageHelper.startPage(user.getPageNum(), user.getPageSize());
        PageHelper.orderBy("id");
        List<User> res = userMapper.getUserList(user);
        PageInfo<User> pageInfo = new PageInfo<>(res);
        return pageInfo;
    }
//    public UserList<User> getUserList(User user, Integer pageNum, Integer pageSize) {
//        UserList<User> userList = userMapper.getUserTotal();
//
//        Integer offset = (pageNum - 1) * pageSize;
//        List<User> res = userMapper.getUserList(user, offset, pageSize);
//
//        userList.setUserList(res);
//        return userList;
//    }
}
